<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'industrycost.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" type="text/css" href="<%=basePath%>/css/biaoge.css"/>
    <script type="text/javascript" src="jquery/js/jquery-1.8.2.js"></script>
    <script type="text/javascript" src="<%=basePath%>/My97DatePicker/WdatePicker.js"></script>
   <style type="text/css">
.go{width:47px;height:100px;background-color:#FFF;position:fixed;_position:absolute;_top:expression(eval(document.documentElement.scrollTop+document.documentElement.clientHeight-this.offsetHeight-(parseInt(this.currentStyle.marginTop,10)||200)-(parseInt(this.currentStyle.marginBottom,10)||0)));left:12px;bottom:25%;border-radius:5px;box-shadow:0 0 2px #6E6E6E}
.go a{background:url(images/a.gif) no-repeat;display:block;text-indent:999em;width:112px;margin:5px;border:0;overflow:hidden;float:left}
.go .top{background-position:-4px -42px;height:23px;width:37px;}
.go .refresh{background-position:-38px -42px;height:23px;width:37px;}
.go .bottom{background-position:-72px -42px;height:22px;width:37px;}
.go .top:hover{background-position:-4px -3px}
.go .refresh:hover{background-position:-38px -3px}
.go .bottom:hover{background-position:-72px -3px}

    </style>
  </head>
  <script type="text/javascript" charset="utf-8">
   $().ready(function(){
      $.post("getAllProduct",function(data){
         var html = "";
         $.each(data.products,function(i,v){
            var option = "<option value='"+v.alias+"' id="+v.productId+">"+v.productName+"</option>";
            html = html+option;
         });
         $("#productName").append(html);
         var pid = $("#productId").val();
         $("#"+pid).attr("selected","selected");
      });
    });
   
   function changep(){
    var id = $("#productName option:selected").attr("id");
    $("#productId").val(id);
   }
   
      function kai(a){
   var k=document.getElementById("zuihou");
  if(a<=1) k.innerHTML="这已经第一页了";
  }
  function zui(a,b){
  var z=document.getElementById("zuihou");
  if(a>=b) z.innerHTML="这已经是最后一页了";
  }
  function changeSubmit(state){
    var form1 = document.from1;
    form1.orstate = state;
    form1.type = "info";
    alert(from1.time1);
    from1.action = "induscostBydate";
    from1.submit();
  }
  </script>
  <body>
  <a name="gotop">&nbsp;</a>
  <div>
  <div style="line-height: 25px;"> 
  
  <form action="orderStatistics" method="post" name="from1">
      交易编号：<input type="text" id="dingid" name="tradeId"> <br/>
     产品名称：<select name="mark" id="productName" onchange="changep()">
						  <option value="" >全部</option>
		</select><br/>
	
      日期查询：
  <input type="text" id="time1" value="${startTime }" name="startTime"
						class="Wdate" onFocus="WdatePicker({maxDate:'#F{$dp.$D(\'time2\')||\'2020-10-01\'}'})"/>
至<input type="text" id="time2" value="${endTime }" name="endTime"
						class="Wdate" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'time1\')}',maxDate:'2020-10-01'})"/>
  <input type="hidden" value="${productId}" name="productId" id="productId"/><br/>
  <input type="hidden" value="1" name="page"/>
  订单状态：
  <font face="Aharoni"> 
	<input type="hidden" name="type"><input type="submit" value="查询"></font>
  
  
  </form>
  
  </div>
    <div style="margin-left:0px;margin-top: 70px">  
     <font size="4" color="red" style="margin-left: 650;font-family:'微软雅黑'" face="Aharoni">
     <ul>
     <c:forEach items="${orderStatistics}" var="orderStatistic">
     
         <c:if test="${orderStatistic.state==0}">
         <li> 退款中订单总额：
         <fmt:formatNumber value="${orderStatistic.amount}" pattern="#,#00.0#"/>(<a href="induscostBydate?orstate=0" target="_blank" >${orderStatistic.count}</a>)&nbsp;&nbsp;&nbsp;&nbsp;</li>
         </c:if>
          <c:if test="${orderStatistic.state==1}">
         <li> 未发货订单总额：
         <fmt:formatNumber value="${orderStatistic.amount}" pattern="#,#00.0#"/>(<a href="induscostBydate?orstate=1" target="_blank" >${orderStatistic.count}</a>)&nbsp;&nbsp;&nbsp;&nbsp;</li>
         </c:if>
          <c:if test="${orderStatistic.state==2}">
         <li>  已发货订单总额：
         <fmt:formatNumber value="${orderStatistic.amount}" pattern="#,#00.0#"/>(<a href="induscostBydate?orstate=2" target="_blank" >${orderStatistic.count}</a>)&nbsp;&nbsp;&nbsp;&nbsp;</li>
         </c:if>
          <c:if test="${orderStatistic.state==3}">
          <li> 交易成功订单总额：
          <fmt:formatNumber value="${orderStatistic.amount}" pattern="#,#00.0#"/>(<a href="induscostBydate?orstate=3" target="_blank" >${orderStatistic.count}</a>)&nbsp;&nbsp;&nbsp;&nbsp;</li>
         </c:if>
	    <c:if test="${orderStatistic.state==4}">
          <li> 交易关闭订单总额：
          <fmt:formatNumber value="${orderStatistic.amount}" pattern="#,#00.0#"/>(<a href="refundOrderList" target="_blank" >${orderStatistic.count}</a>)&nbsp;&nbsp;&nbsp;&nbsp;</li>
         </c:if>  
     </c:forEach>
    </ul>
     </font>
     <c:if test="${type=='info'}">
      <font size="4" color="red" style="margin-left: 650" face="Aharoni">
      ${orstate=='0'?'买家申请退款':''}
	  ${orstate=='1'?'未发货':''}
	  ${orstate=='2'?'已发货':''}
	  ${orstate=='3'?'交易成功':''}
	  ${orstate=='4'?'交易关闭':''}订单
      </font>
    <table id="mytable"  class="td">
     <tr><td><font face="Aharoni">交易编号</font></td><td><font face="Aharoni">订单名称</font></td> <td><font face="Aharoni">下单时间</font></td> <td><font face="Aharoni">各项成本</font></td><td><font face="Aharoni">数量</font></td> <td><font face="Aharoni">订单总额</font></td><td><font face="Aharoni">邮费</font></td><td><font face="Aharoni">订单状态</font></td></tr>
     <c:forEach items="${trades}" var="trade" varStatus="ts">
     <c:forEach items="${trade.orders}" var="order" varStatus="os">
     <tr>
     <c:if test="${os.index==0}" >
     <td rowspan="${trade.count}"><font face="Aharoni"></font></td>
     <c:if test="${os.index==0}">
     <td rowspan="${trade.count }">${order.postfee}</td>
     </c:if>
      <td>${order.orderState_bak}</td>
     </tr>
     </c:forEach> 
     </c:forEach>
    </table>
    </c:if>
   </div>
   <c:if test="${type=='info'}">
  <div style="margin-left: 500px;margin-top:50px">
 <a href="induscostBydate?page=1"> 首页</a> &lt;<a href="induscostBydate?page=${page-1}" onclick="kai(${pagenow})">上一页</a>
							<strong>第${page}页/共${pagecount}页</strong>
							<a href="induscostBydate?page=${page+1}" onclick="zui(${page},${pagecount})"> 下一页</a>&gt;
							<a href="induscostBydate?page=${pagecount}">末页</a>&gt;&gt;
						<font size="2" color="red" id="zuihou"></font>
						</div>
    </div>
  </c:if>
    <div
               style="width: 980px; height: 0px; background: #EEE; margin: 0 auto;"></div>
          <a name="gobottom">&nbsp;</a>
          <div class="go">
               <a title="返回顶部" class="top" href="induscostBydate#gotop"></a>
               <a title="刷新" class="refresh" href="javascript:void()" onclick="location.reload()"></a>
               <a title="返回底部" class="bottom" href="induscostBydate#gobottom"></a>
          </div>
  </body>
</html>
